<!--声明使用的标签库的URI地址-->
<%@taglib  prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page import="com.tecode.myBooks.user.bean.User" %>
<%@ page import="java.util.List" %>
<%@ page import="java.util.ArrayList" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>

<html>
<head>
    <title>Title</title>

</head>
<body>
<h1>EL</h1>
        <!--Out
            值的输出：

        -->
<%
    request.setAttribute("t","<a>");


%>
        <c:out value="${t}" default="abcd" escapeXml="true"/>--${t}

        <!--set  向域中设置一个属性值
            默认域为pageScope中
            scope属性来指定存放到具体的域中
            page   --pageContext
            request  --
            session
            application
        -->
        <c:set value="123" var="pa" scope="page" />
        <c:set value="123" var="pa" scope="request" />
        ${requestScope.pa}

        <!-- remove : 从域中移除一个属性值
             如果没有指定移除哪一个域中的属性，则会移除所有域中的指定属性。

        -->
        <c:remove var="pa"/>
        ---${requestScope.pa}------${pageScope.pa}---

        <!---catch
                异常捕获
        -->
        <c:catch>
                 ${10 /0}
        </c:catch>

        <!--if :判断语句-->

        <c:if test="${param.age > 18}" var="p">
                成年人
        </c:if>
        <c:if test="${!p}">
            未成年
        </c:if>
        <!--
            choose
            when
            otherwise
        --><BR>
        <c:choose>
                <c:when test="${param.age > 18}">
                    未成年
                </c:when>
                <c:when test="${param.age > 28 }">
                    Q
                </c:when>

                <c:when test="${param.age > 38}">
                        Z
                </c:when>
                <c:otherwise>
                    L
                </c:otherwise>

        </c:choose>

        <!--
                forEach：遍历集合，数组
                forTokens：遍历字符串
        -->
        <%
            List<User> userList = new ArrayList<User>();

            userList.add(new User("a1","b1"));
            userList.add(new User("a2","b2"));
            userList.add(new User("a3","b3"));
            userList.add(new User("a4","b4"));
            userList.add(new User("a5","b5"));
            userList.add(new User("a6","b6"));

            request.setAttribute("userList",userList);
        %>
<table>
    <tr><td>姓名</td><td>密码</td></tr>

        <c:forEach items="${requestScope.userList}" var="u" begin="0" step="1" end="5" varStatus="s">
            <tr>
                <td>${u.account}--${s.first}----${s.index}--${s.last}----${s.count}</td>
                <td>${u.pwd}</td>
            </tr>
        </c:forEach>

    <%
        String[] strs = new String[]{"a","b","c","d"};
        request.setAttribute("strs",strs);


    %>
  <%--  <c:forEach items="${strs}" var="s">
                ${s} --
    </c:forEach>--%>
    <!--forTokens-->
    <c:forTokens items="a1b2c3d" delims="\{d}" var="s">
            ${s}<b></b>

    </c:forTokens>

    <!--
            Import
            param
            url
            param
            redirect
            param
    -->
    <c:url value="/jstl.jsp" var="u1">
        <c:param name="age" value="1"/>
    </c:url>
    ${u1}
    <!--页面的包含 相等于include-->
    <c:import url="el.jsp" >
        <c:param name="ages" value="999"/>

    </c:import>

    <c:redirect url="http://www.baidu.com"></c:redirect>

</table>
</body>
</html>
